<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
    <%@ page import="com.library.dao.Librarian" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Đăng ký user mới</title>
<%
Librarian user=(Librarian)session.getAttribute("instantUser");
%>
<script>
function validateForm()
{
	var pass1 = document.forms["form1"]["password"].value;
	var pass2 = document.forms["form1"]["password2"].value;
	var id = document.forms["form1"]["userid"].value;
	if (id == "" || isNaN(id)) {
		alert("UserId không phải là chữ số");
		return false;
	}
	if (pass1 != pass2) {
		alert("Mật khẩu nhập lại không đúng");
		return false;
	}
	return true;
	
}
</script>
</head>
<body>
<jsp:include page="librarianmenu.jsp" /> 
<br>
<br>
<form id="form1" name="form1" method="post" action="/librarysystem/CreateUserServlet" onsubmit="return validateForm()">
  <table width="70%" border="0">
  <tr>
      <td width="93" height="31">UserId</td>
      <td width="200"><input name="userid" type="text" id="textfield" size="50"/></td>
    </tr>
    <tr>
      <td width="93" height="31">Email</td>
      <td width="200"><input name="email" type="text" id="textfield" size="50"  /></td>
    </tr>
    <tr>
      <td>Mật khẩu</td>
      <td><label>
        <input name="password" type="password" id="textfield2" size="30" />
      </label></td>
    </tr>
    <tr>
      <td>Nhập lại mật khẩu</td>
      <td><label>
        <input name="password2" type="password" id="textfield2" size="30" />
      </label></td>
    </tr>
    <tr>
      <td>Tên</td>
      <td><label>
        <input name="username" type="text" id="textfield2" size="30" />
      </label></td>
    </tr>
    <tr>
      <td><p>Địa chỉ </p></td>
      <td><input name="address" type="text" id="textfield3" size="50" /></td>
    </tr>
    <tr>
      <td>Số điện thoại</td>
      <td><input type="text" name="phone" id="textfield4" /></td>
    </tr>
    <tr>
      <td><label>
        <input type="submit" value="Create User" />
      </label></td>
      <td>&nbsp;</td>
    </tr>
  </table>
  <p>&nbsp;</p>
</form>
</body>
</html>